package com.century.sjt.activity;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import com.century.sjt.R;
import com.century.sjt.util.Constant;
import com.century.sjt.widget.TitleBar.SjtTitleBar;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author:周玲波
 * @Description: 激活快捷支付
 * @date : 2016/8/22 20:18
 */
public class ShortcutPayActivity extends BaseActivity {
    private String phone, bankCardNo, bankCode, bankName, bankType, status;
    @BindView(R.id.shortcut_pay_bankcardno)
    EditText et_bank_card;
    @BindView(R.id.shortcut_pay_username)
    EditText et_user_name;
    @BindView(R.id.shortcut_pay_phone)
    EditText et_phone;
    @BindView(R.id.shortcut_title)
    SjtTitleBar title;
    private String name;
    private String isRealName;
    private String idCard;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.shortcut_pay_activity);
        ButterKnife.bind(this);
        initData();
        initView();
    }

    @Override
    protected void initView() {
        title.setTitle(getResources().getString(R.string.text_activation_quick_pay));
        title.setLeftIconResource(getResources().getString(R.string.icon_return));
        title.setLeftLayoutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        SharedPreferences mainSharedPreferences = getSharedPreferences(Constant.TAG, Activity.MODE_PRIVATE);
        name = mainSharedPreferences.getString("name", "");
        isRealName = mainSharedPreferences.getString("isRealName", "");
        idCard = mainSharedPreferences.getString("idCard", "");
        et_user_name.setEnabled(false);
        et_user_name.setText(name);
        et_bank_card.setEnabled(false);
        et_bank_card.setText(bankCardNo.substring(0,4)+ " **** **** " + idCard.substring(idCard.length() - 4, idCard.length()));
        et_phone.setText(phone.substring(0,3) + " **** " + phone.substring(phone.length()-4,phone.length()));
    }

    @Override
    protected void initEvent() {
        //activateSendAuthCode();
    }

    @Override
    protected void initData() {
        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            this.phone = bundle.getString("phone");
            this.bankCardNo = bundle.getString("bankCardNo");
            this.bankCode = bundle.getString("bankCode");
            this.bankName = bundle.getString("bankName");
            this.bankType = bundle.getString("bankType");
            this.status = bundle.getString("status");
        }
    }
}
